-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] Remove _check_tfr_params from Transformer constructor #11004
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since the _check_tfr_param function changes some of the values it checks, scikit-learn estimators must perform this check at runtime, not during estimator instantiation. Failing to do so leads to an error.
If the constructor modifies non-default parameters, scikit-learn will throw an error during cloning.
Checking and transforming in the constructor violates sklearn best-practice. Since this check is already performed in the `_compute_tfr` method, we can simply remove the check from the transformer class.
Since options checking doesn't modify the value it makes sense to keep it in the constructor.
…n into time_frequency
Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴🏽♂️ |
🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference issue
Fixes #10971.
What does this implement/fix?
The
mne.decoding.time_frequency.TimeFrequency
transformer called themne.time_frequency.tfr._check_tfr_params
function in the constructor. This function violates scikit-learn best practices on estimators, since it modifies some of the input parameters.This PR removes the call to
_check_tfr_params
, since it is called later in the_compute_tfr
method anyway. The_check_option
call can remain, since it doesn't modify parameters.